package com.youlu.campus.admin.ca.controller;

import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.entity.CaOrganization;
import com.youlu.campus.entity.VO.req.CaOrgReq;
import com.youlu.campus.service.ca.impl.CaOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CaOrganizationController {

    @Autowired
    private CaOrganizationService caOrganizationService;

    @PostMapping("/ca-org/add")
    public RestResult save(@RequestBody CaOrganization caOrganization){
        caOrganizationService.save(caOrganization);
        return RestResultBuilder.builder().success().build();
    }

    @PostMapping("/ca-org/list")
    public RestResult list(@RequestBody CaOrgReq caOrgReq){
        return RestResultBuilder.builder().data(caOrganizationService.list(caOrgReq)).success().build();
    }
}
